﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Fur.Htx.Database.Migrations.Migrations
{
    public partial class init2 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Sys_UserDetail",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Phone = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "手机号"),
                    Address = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "地址"),
                    Email = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "邮箱"),
                    UserId = table.Column<int>(type: "int", nullable: false, comment: "用户id"),
                    CreatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
                    UpdatedTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_UserDetail", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Sys_UserDetail_Sys_User_UserId",
                        column: x => x.UserId,
                        principalTable: "Sys_User",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.UpdateData(
                table: "Sys_User",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2021, 9, 9, 11, 4, 40, 123, DateTimeKind.Unspecified).AddTicks(34), new TimeSpan(0, 8, 0, 0, 0)));

            migrationBuilder.UpdateData(
                table: "Sys_User",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2021, 9, 9, 11, 4, 40, 128, DateTimeKind.Unspecified).AddTicks(4887), new TimeSpan(0, 8, 0, 0, 0)));

            migrationBuilder.UpdateData(
                table: "Sys_User",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2021, 9, 9, 11, 4, 40, 128, DateTimeKind.Unspecified).AddTicks(4948), new TimeSpan(0, 8, 0, 0, 0)));

            migrationBuilder.CreateIndex(
                name: "IX_Sys_UserDetail_UserId",
                table: "Sys_UserDetail",
                column: "UserId",
                unique: true);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Sys_UserDetail");

            migrationBuilder.UpdateData(
                table: "Sys_User",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2021, 9, 9, 10, 46, 23, 619, DateTimeKind.Unspecified).AddTicks(1153), new TimeSpan(0, 8, 0, 0, 0)));

            migrationBuilder.UpdateData(
                table: "Sys_User",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2021, 9, 9, 10, 46, 23, 625, DateTimeKind.Unspecified).AddTicks(239), new TimeSpan(0, 8, 0, 0, 0)));

            migrationBuilder.UpdateData(
                table: "Sys_User",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedTime",
                value: new DateTimeOffset(new DateTime(2021, 9, 9, 10, 46, 23, 625, DateTimeKind.Unspecified).AddTicks(291), new TimeSpan(0, 8, 0, 0, 0)));
        }
    }
}
